
<ul class="pagination">

    {% if kwd['page_home'] %}
    <li>
        <a class="{0}" href="/entity_download/{{user_id}}/1">{{ _('Home') }} </a>
    </li>
    {% end %}

    {% if kwd['page_pre'] %}
    <li>
        <a class="{0}" href="/entity_download/{{user_id}}/{{ page_current - 1 }}">{{ _('Previous page') }}</a>
    </li>
    {% end %}

    {% set cur_num = page_current
    if cur_num > 5:
        cur_num = cur_num - 4
    else:
        cur_num = 1
    if pager_num > 10 and cur_num < pager_num - 10:
        show_num = cur_num + 10
    else:
        show_num = pager_num + 1
    %}
    {% for page_index in range(cur_num, show_num ) %}
    <li class="{% if page_current == page_index %}active{% end %}">
        <a href="/entity_download/{{user_id}}/{{ page_index }}">{{ page_index }}</a></li>
    {% end %}

    {% if kwd['page_next'] %}
    <li>
        <a class="{0}" href="/entity_download/{{user_id}}/{{ page_current +1 }}">{{ _('Next page') }}</a>
    </li>
    {% end %}

    {% if kwd['page_end'] %}
    <li>
        <a class="{0}" href="/entity_download/{{user_id}}/{{ pager_num }}">{{ _('End') }}</a>
    </li>
    {% end %}
</ul>
{% if pager_num >= 15 %}
<div class="row">
    <div class="col-sm-12">
        Go to <input id="changePage" type="text" size="1" maxlength="4" style="border:0; background: none; border-bottom: 1px solid #036; height: 20px "/> page
        <a href="#" id="btn5" class="btn btn-xs btn-primary">{{ _('Jump') }}</a>
        <b id="fyts" class="red"></b>
        <script type="text/javascript">
            var page = '{{pager_num}}';
            $("#btn5").click(function changePage() {
                var curPage = document.getElementById("changePage").value * 1;
                if (!/^[1-9]\d*$/.test(curPage)) {
                     $("#fyts").val("Please enter a positive integer");
                    return;
                }
                if (curPage > page) {
                    $("#fyts").val("Exceed the data page");
                    return;
                }
                window.location.href = "/entity_download/{{user_id}}/" + curPage;
            });
        </script>
    </div>
</div>
<br>
{% end %}